// import { Server } from "ws";



function soket(fn1,port){
    
const ws = new WebSocket(`ws://localhost:${port}`)
ws.onopen = () => {
    console.log("客户端链接成功");
}
ws.onclose = () => {
    console.log("客户端断开链接");
    ws.close()
}
ws.onerror = () => {
    console.log("链接出错了");
}
// ws.onmessage = (el) => {

// }
ws.addEventListener("message",fn1)
return ws

}

export default soket